﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;

namespace EmbDocumentInhalatorSetup.ToolClasses
{
    public class ItemTemplateSelector : DataTemplateSelector
    {

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {

            DataTemplate dt = null;
            ContentPresenter cp = container as ContentPresenter;

            if (item != null && item is Solution)
            {

                Solution nvp = item as Solution; 
                
                switch (nvp.IsInstalledOnServer)
                {

                    case true:

                        dt = cp.FindResource("cellTemplateIsInstalled") as DataTemplate;
                        break;

                    case false:
                        dt = cp.FindResource("cellTemplateIsNotInstalled") as DataTemplate;

                        break;
                }

                return dt;
            }

            return null;
        }
    }
}